<!DOCTYPE html>
<html>
 <head> 
  <meta charset="UTF-8" /> 
  <title>新增菜单</title> 
  <link rel="stylesheet" href="/assets/layui/css/layui.css" media="all" />
 </head> 
 <body> 
  <div class="admin-main">  
   <form class="layui-form" action="/api/perm/resource/add">  
    <input type="hidden" name="type" value="menu" /> 
    <input type="hidden" id="parentId" name="parentId" /> 
       <div class="layui-form-item"> 
        <label class="layui-form-label">新增根节点</label> 
        <div class="layui-input-block"> 
         <input type="checkbox" value="true" lay-skin="switch" lay-text="是|否" /> 
        </div> 
       </div>
       <div class="layui-form-item switch-off"> 
        <label class="layui-form-label">父级菜单</label> 
        <div class="layui-form-mid layui-word-aux" id="parentName">无</div> 
       </div>
       <div class="layui-form-item"> 
        <label class="layui-form-label">所属平台</label> 
        <div class="layui-input-block"> 
         <select id="platformType" name="platformType" lay-verify="required" lay-filter="module_select">
            <option value="console-admin">运营端</option>
            <option value="console-company">企业端</option>
         </select> 
        </div> 
       </div>
       <div class="layui-form-item"> 
        <label class="layui-form-label">菜单名称</label> 
        <div class="layui-input-block"> 
         <input type="text" class="layui-input" name="name" lay-verify="required" placeholder="请输入菜单名称" /> 
        </div> 
       </div> 
       <div class="layui-form-item switch-off"> 
        <label class="layui-form-label">菜单链接</label> 
        <div class="layui-input-block"> 
         <input type="text" class="layui-input" name="uri" placeholder="请输入菜单链接地址" /> 
        </div> 
       </div>     
    <div class="layui-form-item"> 
     <div class="layui-input-block"> 
        <input type="button"  class="layui-btn layui-btn-normal J_ajaxSubmit" value="保存"/>
        <input type="reset" class="layui-btn layui-btn-primary" value="重置"/>
     </div> 
    </div> 
   </form> 
  </div> 
 </body>
<script type="text/javascript" src="/assets/layui/layui.js"></script>
<script type="text/javascript" src="/modules/resource/resource.js"></script>
<script>
layui.use(['jeesuitelayui'], function() {
	var $ = layui.jquery;
	$('#parentId').val(parent.currentMenu.id);
	$('#parentName').html(parent.currentMenu.name);
	$("body").on('click',".layui-form-switch",function() {
		var $selected = $(this).hasClass('layui-form-onswitch');
		if ($selected) {
			$('.switch-off').hide();
			$('.switch-on').show();
			$('#parentId').val('');
		} else {
			$('.switch-on').hide();
			$('.switch-off').show();
		}
	 });
});
</script>
</html>